on xMouseDown ml, IsActivate, CmdKeyWasDown, ShiftKeyWasDown, CapsLockKeyWasDown, OptionKeyWasDown, ControlKeyWasDown
if CmdKeyWasdown then
put true into CommandKeyWasOrIsDown
exit xMouseDown
end if
put TheMouseLoc.integerType[2] into h
put TheMouseLoc.integerType[1] into v
get HandleButton(h,v)
if it="2 false" then
DoDraw TheMouseLoc,ShiftKeyWasDown
else if it="3 true" then put 1 into tool1
else if it="4 true" then put 3 into tool1
else if it="5 true" then put 3 into tool1
else if it="6 true" then put 2 into tool1
else if it="7 false" then
if OptionKeyWasDown then PickAColor ShiftKeyWasDown
else
put 32767 into Color.integerType[1]
put 32767 into Color.integerType[2]
put 32767 into Color.integerType[3]
end if
else if it="8 false" then
if OptionKeyWasDown then PickAColor ShiftKeyWasDown
else
put 0 into Color.integerType[1]
put 0 into Color.integerType[2]
put 0 into Color.integerType[3]
end if
else if it="9 false" then
if OptionKeyWasDown then PickAColor ShiftKeyWasDown
else
put -1 into Color.integerType[1]
put -1 into Color.integerType[2]
put -1 into Color.integerType[3]
end if
end if
end xMouseDown
on xMouseUp TheMouseLoc, IsActivate, CmdKeyWasDown, ShiftKeyWasDown, CapsLockKeyWasDown, OptionKeyWasDown, ControlKeyWasDown
end xMouseUp
on xKeyDown TheKey, IsActivate, CmdKeyWasDown, ShiftKeyWasDown, CapsLockKeyWasDown, OptionKeyWasDown, ControlKeyWasDown
end xKeyDown
on xKeyUp TheKey, IsActivate, CmdKeyWasDown, ShiftKeyWasDown, CapsLockKeyWasDown, OptionKeyWasDown, ControlKeyWasDown
end xKeyUp
on xAutoKey TheKey, IsActivate, CmdKeyWasDown, ShiftKeyWasDown, CapsLockKeyWasDown, OptionKeyWasDown, ControlKeyWasDown
end xAutoKey
on xUpdateWindow WindowPtr
end xUpdateWindow
on xDiskInserted DriveNumber, ResultCode
end xDiskInserted
on xActivate WindowPtr
end xActivate
on xAppleEvent p1, p2
end xAppleEvent
on xOpertatingSystem
end xOpertatingSystem
on xNullEvent
end xNullEvent
Function HandleEvent
get WaitNextEvent(2, MyEventRecord,1000, NIL)
put MyEventRecord.where into TheMouseLoc
put MyEventRecord.when into TheTicks
put MyEventRecord.Message into TheMsg
put MyEventRecord.modifiers into TheModifiers
put (BitAnd(TheModifiers,1)≠0) into IsActivate
put (BitAnd(TheModifiers,128)≠0) into ButtonWasUp
put (BitAnd(TheModifiers,256)≠0) into CmdKeyWasDown
put (BitAnd(TheModifiers,512)≠0) into ShiftKeyWasDown
put (BitAnd(TheModifiers,1024)≠0) into CapsLockKeyWasDown -- alphaLock
put (BitAnd(TheModifiers,2048)≠0) into OptionKeyWasDown
put (BitAnd(TheModifiers,4096)≠0) into ControlKeyWasDown
if it then
if MyEventRecord.integerType=1 then xMouseDown TheMouseLoc, IsActivate,CmdKeyWasDown,ShiftKeyWasDown,CapsLockKeyWasDown,OptionKeyWasDown,ControlKeyWasDown
if MyEventRecord.integerType=2 then xMouseUp TheMouseLoc, IsActivate,CmdKeyWasDown,ShiftKeyWasDown,CapsLockKeyWasDown,OptionKeyWasDown,ControlKeyWasDown
if MyEventRecord.integerType=3 then xKeyDown theMsg.charType[3], IsActivate,CmdKeyWasDown,ShiftKeyWasDown,CapsLockKeyWasDown,OptionKeyWasDown,ControlKeyWasDown
if MyEventRecord.integerType=4 then xKeyUp theMsg.charType[3], IsActivate,CmdKeyWasDown,ShiftKeyWasDown,CapsLockKeyWasDown,OptionKeyWasDown,ControlKeyWasDown
if MyEventRecord.integerType=5 then xAutoKey theMsg.charType[3], IsActivate,CmdKeyWasDown,ShiftKeyWasDown,CapsLockKeyWasDown,OptionKeyWasDown,ControlKeyWasDown
if MyEventRecord.integerType=6 then xUpdateWindow theMsg -- theMsg is ponter to window
if MyEventRecord.integerType=7 then xDiskInserted LoWord(theMsg),hiWord(theMsg)
if MyEventRecord.integerType=8 then xActivate theMsg -- pointer to window
if MyEventRecord.integerType=10 then xAppleEvent theMsg,TheMouseLoc
if MyEventRecord.integerType=-15 then xOpertatingSystem